import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.tianxiabuyi.Message;
import com.tianxiabuyi.model.pojo.User;
import com.tianxiabuyi.persist.QBuilder;
import com.tianxiabuyi.utils.JSONUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by eeesys on 2017/5/27 0027.12:30
 */
public class test {
    public static void sss() {
        Message msg = new Message();
        List<User> list = new ArrayList<>();
        User user = new User();
        user.setName("jack");
        list.add(user);
        msg.put("data", list);


        String json = JSONUtil.toJson(msg);
        msg = JSONUtil.fromJson(json, Message.class);
        System.out.println((List)msg.get("data") );
        System.out.println(msg.getErrcode() == 0);
        System.out.println("中文是否乱码");
    }
    public static void main(String[] args) {
        String str = "\\\\";
        List list = QBuilder.db("basedb").queryHql(String.format("from HospitalUser where locate ('%s', name) > 0", new Object[]{str}), 1 , 1);
        System.out.println(JSONUtil.toJson(list));
    }
}
